// 定义
var MyComponent = Vue.extend({
  template: ['<table class="table table-bordered table-condensed table-striped">',
    '<thead>',
    '<tr class="info">',
    '<th v-for="column in columns"></th>',
    '</tr>',
    '</thead>',
    '<tbody>',
    '<tr v-for="item in items">',
    '<td v-for="column in columns">',
    '{{item[column]}}',
    '</td>',
    '</tr>',
    '</tbody>',
    '</table>'
  ].join(''),
  mode: 'modeList',

  props: {
    items: {
      type: Object,
      twoWay: false,
      required: true
    },
    mode: {
      type: String,
      default: 'modeList'
    },
    onEdit: {
      type: Function,
      required: true
    },
    pagenum: {
      type: String,
      required: true
    },
    onRemove: {
      type: Function,
      required: true
    },
    onChange: {
      type: Function,
      required: true
    }
  },

  components: {},
  data: function () {
    return {
      result: null,
    }
  },

  methods: {
    onEditItem: function (item) {
      console.log('onSubmitClick: inside component itemelist');
      console.log('editor list' + item);
      //this.result = this.onSubmit(this.mode, this.item);
      this.result = this.onEdit(item, 'modeEdit');
    },
    onRemoveItem: function (item) {
      console.log('onRemoveClick: inside component itemelist');
      vm.onRemove(item);
    },
    onPagenum: function () {
      console.log('onPagenum: inside component itemelist');
      vm.pagenum = this.pagenum
      vm._find('', this.pagenum, '');
    },
    ondownload: function (item) {
      console.log('download: inside component itemelist');
      vm.download(item);
    }
  }
})
// 注册
Vue.component('itemlist', MyComponent)
